package com.chen.demo.handler.exception;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 统一 的异常处理类
 * 
 * @author Administrator
 *
 */
@ControllerAdvice
public class GlobalExceptionHandler {

	@ExceptionHandler(value = Exception.class)
	@ResponseBody
	private Map<String, Object> exceptionHandler(HttpServletRequest request, Exception e) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", false);
		map.put("reemsg", e.getMessage());
		return map;

	}

}
